package com.predict.javademo.utils;

import org.apache.commons.codec.binary.Base64;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

public class Base64Utils {

    public static String img2Base64String(MultipartFile img){
        try {
            return new String(Base64.encodeBase64(img.getBytes()));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}
